/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package config;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 *
 * @author Abah
 */
public class DBConnection {
    private Connection koneksi;

    public Connection connect(){
        //utk koneksi ke driver
        try {
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("berhasil load ke driver");            
        }catch(ClassNotFoundException cnfe){
            System.out.println("Tidak ada driver " + cnfe);
        }

        //untuk koneksi ke database
        try{
            String url = "jdbc:mysql://localhost:3306/juwitamakmur";
            koneksi=DriverManager.getConnection(url, "root","");
            System.out.println("Berhasil koneksi");
        }catch(SQLException se){
            System.out.println("Gagal koneksi " + se);
        }
        return koneksi;
    }
}
